/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.atm.user.gui;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionListener;
import java.awt.event.KeyListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JProgressBar;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import com.atm.user.language.Language;

/**
 *
 * @author TuanNguyen
 */
public class ATMUserGUI extends javax.swing.JFrame {

    private int screenType;
    private String username;//tên tài khoản

    public ATMUserGUI() {
        centreWindow(this);
        setWindowLookAndFeel();

        add(new ContentPanel());
        setSize(500, 300);
        setTitle("ATM User");
        initComponents();
        setScreen(0);

    }

    public void setWindowLookAndFeel() {
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(ATMUserGUI.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(ATMUserGUI.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(ATMUserGUI.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(ATMUserGUI.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static void centreWindow(Window frame) {
        Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (int) ((dimension.getWidth() - frame.getWidth()) / 4);
        int y = (int) ((dimension.getHeight() - frame.getHeight()) / 10);
        frame.setLocation(x, y);
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setMessageMid(String msg) {
        lbMid.setVisible(true);
        lbMid.setText(msg);
    }

    public void setMessageTop(String msg) {
        lbTop.setVisible(true);
        lbTop.setText(msg);
    }

    public void setInquiry(String msg) {
        lbInquiry.setVisible(true);
        lbInquiry.setText(msg);
    }

    public void setType(String msg) {
        lbType.setVisible(true);
        lbType.setText(msg);
    }

    public void setAmount(String msg) {
        lbAmount.setVisible(true);
        lbAmount.setText(msg);
    }

    public void setTime(String msg) {
        lbTime.setVisible(true);
        lbTime.setText(msg);
    }

    public void setProgress(int progress) {
        pbTransaction.setVisible(true);
        pbTransaction.setValue(progress);
    }

    public int getScreenType() {
        return screenType;
    }

    public void setScreenType(int screenType) {
        this.screenType = screenType;
    }

    public void addProcessListener(ActionListener al) {// thêm lắng nghe sự kiện click Button
        bt1.addActionListener(al);
        bt2.addActionListener(al);
        bt3.addActionListener(al);
        bt4.addActionListener(al);
        bt5.addActionListener(al);
        bt6.addActionListener(al);
        bt7.addActionListener(al);
        bt8.addActionListener(al);

    }

    public void addKeyPressListener(KeyListener kl) {//thêm lắng nghe sự kiện ấn nút Enter
        txtAccNo.addKeyListener(kl);
        pfPIN.addKeyListener(kl);
        pfCash.addKeyListener(kl);
    }

    public void setScreen(int screenType) {//thiết lập các màn hình của app

        this.screenType = screenType;
        System.out.println("screen=" + screenType);

        lbTop.setVisible(false);

        bt1.setVisible(false);
        bt2.setVisible(false);
        bt3.setVisible(false);
        bt4.setVisible(false);
        bt5.setVisible(false);
        bt6.setVisible(false);
        bt7.setVisible(false);
        bt8.setVisible(false);

        lb1.setVisible(false);
        lb2.setVisible(false);
        lb3.setVisible(false);
        lb4.setVisible(false);
        lb5.setVisible(false);
        lb6.setVisible(false);
        lb7.setVisible(false);
        lb8.setVisible(false);

        lbGuide.setVisible(false);
        txtAccNo.setVisible(false);
        txtAccNo.setEnabled(false);
        lbInfo.setVisible(false);
        lbMid.setVisible(false);
        pfPIN.setVisible(false);
        pfPIN.setEnabled(false);
        pfCash.setVisible(false);
        pfCash.setEnabled(false);
        pbTransaction.setVisible(false);
        lbInquiry.setVisible(false);
        lbInfo.setVisible(true);
        lbInfo.setText(Language.getInstance().getAuthor1());
        lbType.setVisible(false);
        lbAmount.setVisible(false);
        lbTime.setVisible(false);

//        UIManager.put("ProgressBar.background", Color.orange);
//        UIManager.put("ProgressBar.foreground", Color.blue);
//        UIManager.put("ProgressBar.selectionBackground", Color.red);
//        UIManager.put("ProgressBar.selectionForeground", Color.green);

        switch (screenType) {
            case 0://màn hình chọn ngôn ngữ
                lbTop.setVisible(true);
                lbTop.setText("<html>Vui lòng lựa chọn ngôn ngữ<br>Please select your language</html>");

                bt7.setVisible(true);
                bt8.setVisible(true);

                lb7.setVisible(true);
                lb8.setVisible(true);

                lb7.setText("TIẾNG VIỆT");
                lb8.setText("ENGLISH");
                break;
            case 1://màn hình chọn nhập số tài tài khoản
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getTypeAccNo());

                bt4.setVisible(true);
                lb4.setVisible(true);
                lb4.setText(Language.getInstance().getExit());

                lbGuide.setVisible(true);
                lbGuide.setText(Language.getInstance().getPressEnter());
                txtAccNo.setVisible(true);
                txtAccNo.setEnabled(true);
                txtAccNo.setText("");
                txtAccNo.requestFocusInWindow();
                break;
            case 2://màn hình chọn nhập mã PIN
                lbTop.setVisible(true);
                lbTop.setText("<html>" + Language.getInstance().getHello() + " " + username + "<br>" + Language.getInstance().getTypeAccPIN() + "</html>");

                bt4.setVisible(true);
                lb4.setVisible(true);
                lb4.setText(Language.getInstance().getExit());

                lbGuide.setVisible(true);
                lbGuide.setText(Language.getInstance().getPressEnter());
                pfPIN.setVisible(true);
                pfPIN.setEnabled(true);
                pfPIN.setEchoChar('*');
                pfPIN.setText("");
                pfPIN.requestFocusInWindow();
                break;
            case 3://màn hình chọn các chức năg
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getSelectFuntion());

                bt1.setVisible(true);
                bt2.setVisible(true);
                bt3.setVisible(true);
                bt4.setVisible(true);
                bt5.setVisible(true);
                bt6.setVisible(true);
                bt7.setVisible(true);
                bt8.setVisible(true);

                lb1.setVisible(true);
                lb2.setVisible(true);
                lb3.setVisible(true);
                lb4.setVisible(true);
                lb5.setVisible(true);
                lb6.setVisible(true);
                lb7.setVisible(true);
                lb8.setVisible(true);

                lb1.setText(Language.getInstance().getFuntion_changePIN());
                lb2.setText(Language.getInstance().getFuntion_balanceInquiry());
                lb3.setText(Language.getInstance().getFuntion_about());
                lb5.setText(Language.getInstance().getFuntion_cashWithDraw());
                lb6.setText(Language.getInstance().getFuntion_cashDeposit());
                lb7.setText(Language.getInstance().getFuntion_fundTransfer());
                lb8.setText(Language.getInstance().getFuntion_miniStatement());

                break;

            case 4://màn hình nhập PIN cũ
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getTypeAccOldPIN());

                bt4.setVisible(true);
                lb4.setVisible(true);

                lbGuide.setVisible(true);
                lbGuide.setText(Language.getInstance().getPressEnter());
                pfPIN.setVisible(true);
                pfPIN.setEnabled(true);
                pfPIN.setEchoChar('*');
                pfPIN.setText("");
                pfPIN.requestFocusInWindow();
                break;

            case 5://màn hình nhập PIN mới
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getTypeAccNewPIN());

                bt4.setVisible(true);
                lb4.setVisible(true);

                lbGuide.setVisible(true);
                lbGuide.setText(Language.getInstance().getPressEnter());
                pfPIN.setVisible(true);
                pfPIN.setEnabled(true);
                pfPIN.setEchoChar('*');
                pfPIN.setText("");
                pfPIN.requestFocusInWindow();
                break;
            case 6://màn hình nhập  lại PIN mới
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getTypeAccReNewPIN());

                bt4.setVisible(true);
                lb4.setVisible(true);

                lbGuide.setVisible(true);
                lbGuide.setText(Language.getInstance().getPressEnter());
                pfPIN.setVisible(true);
                pfPIN.setEnabled(true);
                pfPIN.setEchoChar('*');
                pfPIN.setText("");
                pfPIN.requestFocusInWindow();
                break;
            case 7://màn hình chuyển hướng 3 giây
                lbTop.setVisible(true);
                lbMid.setVisible(true);
                break;
            case 8://màn hình hỏi thoát hệ thống
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getExitSystem());

                bt7.setVisible(true);
                bt8.setVisible(true);

                lb7.setVisible(true);
                lb8.setVisible(true);

                lb7.setText(Language.getInstance().getYes());
                lb8.setText(Language.getInstance().getNo());
                break;
            case 9://màn hình gửi tiền
                lbTop.setVisible(true);
                lbTop.setText("<html>" + Language.getInstance().getTypeCashDeposit() + "<br>" + Language.getInstance().getCastDepositCondition1() + "</html>");

                bt4.setVisible(true);
                lb4.setVisible(true);

                pfCash.setVisible(true);
                pfCash.setEnabled(true);
                pfCash.requestFocusInWindow();
                pfCash.setText("");

                lbGuide.setVisible(true);
                lbGuide.setText(Language.getInstance().getPressEnter());
                break;
            case 10://màn hình xác nhận gửi tiền
                lbTop.setVisible(true);

                bt7.setVisible(true);
                bt8.setVisible(true);

                lb7.setVisible(true);
                lb8.setVisible(true);

                lb7.setText(Language.getInstance().getYes());
                lb8.setText(Language.getInstance().getNo());
                break;
            case 11://màn hình đang thực hiện giao dịch
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getTransactionProcess());
                pbTransaction.setVisible(true);
                pbTransaction.setValue(0);
                break;
            case 12:// màn hình rút tiền
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getSelectDesiredAmount());

                bt1.setVisible(true);
                bt2.setVisible(true);
                bt3.setVisible(true);
                bt4.setVisible(true);
                bt5.setVisible(true);
                bt6.setVisible(true);
                bt7.setVisible(true);
                bt8.setVisible(true);

                lb1.setVisible(true);
                lb2.setVisible(true);
                lb3.setVisible(true);
                lb4.setVisible(true);
                lb5.setVisible(true);
                lb6.setVisible(true);
                lb7.setVisible(true);
                lb8.setVisible(true);

                lb1.setText("50,000");
                lb2.setText("100,000");
                lb3.setText("200,000");

                lb5.setText("500,000");
                lb6.setText("1,000,000");
                lb7.setText("2,000,000");
                lb8.setText(Language.getInstance().getOther());

                break;
            case 13:// màn hình nhập số tiền
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getTypeCashWithDraw());

                lbMid.setVisible(true);
                lbMid.setText("<html>" + Language.getInstance().getDieuKienRutTien1()
                        + "<br>" + Language.getInstance().getDieuKienRutTien2()
                        + "<br>" + Language.getInstance().getDieuKienRutTien3()
                        + "<html/>");

                bt4.setVisible(true);
                lb4.setVisible(true);

                pfCash.setVisible(true);
                pfCash.setEnabled(true);
                pfCash.requestFocusInWindow();
                pfCash.setText("");

                lbGuide.setVisible(true);
                lbGuide.setText(Language.getInstance().getPressEnter());

                break;
            case 14:// màn hình chuyển tiền,nhập tài khoản người nhận
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getTypeDestinationAccNo());

                bt4.setVisible(true);
                lb4.setVisible(true);
                lb4.setText(Language.getInstance().getExit());

                lbGuide.setVisible(true);
                lbGuide.setText(Language.getInstance().getPressEnter());
                txtAccNo.setVisible(true);
                txtAccNo.setEnabled(true);
                txtAccNo.setText("");
                txtAccNo.requestFocusInWindow();
                break;
            case 15:// màn hình nhập số tiền để chuyển
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getTypeFundTransfer());

                lbMid.setVisible(true);
                lbMid.setText("<html>" + Language.getInstance().getDieuKienChuyenTien1()
                        + "<br>" + Language.getInstance().getDieuKienChuyenTien2()
                        + "<html/>");

                bt4.setVisible(true);
                lb4.setVisible(true);

                pfCash.setVisible(true);
                pfCash.setEnabled(true);
                pfCash.requestFocusInWindow();
                pfCash.setText("");

                lbGuide.setVisible(true);
                lbGuide.setText(Language.getInstance().getPressEnter());

                break;
            case 16://màn hình hỏi thoát hệ thống
                lbTop.setVisible(true);

                bt7.setVisible(true);
                bt8.setVisible(true);

                lb7.setVisible(true);
                lb8.setVisible(true);

                lb7.setText(Language.getInstance().getYes());
                lb8.setText(Language.getInstance().getNo());
                break;
            case 17://màn hình about us
                lbTop.setVisible(true);
                lbTop.setText(Language.getInstance().getAuthor1());

                lbInquiry.setVisible(true);
                String authorInfo = "<html>" + Language.getInstance().getAuthor2()
                        + "<br><br>" + Language.getInstance().getAuthor3()
                        + "<br><br>" + Language.getInstance().getAuthor4()
                        + "<br><br>" + Language.getInstance().getAuthor5()
                        + "<html/>";
                lbInquiry.setText(authorInfo);

                bt4.setVisible(true);
                lb4.setVisible(true);
                break;
            case 18://màn hình Vấn tin tài khoản
                lbTop.setVisible(true);

                bt4.setVisible(true);
                lb4.setVisible(true);

//                lbType.setVisible(true);
//                lbAmount.setVisible(true);
//                lbTime.setVisible(true);

                break;
        }
    }

    public JButton getBt1() {
        return bt1;
    }

    public void setBt1(JButton bt1) {
        this.bt1 = bt1;
    }

    public JButton getBt2() {
        return bt2;
    }

    public void setBt2(JButton bt2) {
        this.bt2 = bt2;
    }

    public JButton getBt3() {
        return bt3;
    }

    public void setBt3(JButton bt3) {
        this.bt3 = bt3;
    }

    public JButton getBt4() {
        return bt4;
    }

    public void setBt4(JButton bt4) {
        this.bt4 = bt4;
    }

    public JButton getBt5() {
        return bt5;
    }

    public void setBt5(JButton bt5) {
        this.bt5 = bt5;
    }

    public JButton getBt6() {
        return bt6;
    }

    public void setBt6(JButton bt6) {
        this.bt6 = bt6;
    }

    public JButton getBt7() {
        return bt7;
    }

    public void setBt7(JButton bt7) {
        this.bt7 = bt7;
    }

    public JButton getBt8() {
        return bt8;
    }

    public void setBt8(JButton bt8) {
        this.bt8 = bt8;
    }

    public JLabel getLb1() {
        return lb1;
    }

    public void setLb1(JLabel lb1) {
        this.lb1 = lb1;
    }

    public JLabel getLb2() {
        return lb2;
    }

    public void setLb2(JLabel lb2) {
        this.lb2 = lb2;
    }

    public JLabel getLb3() {
        return lb3;
    }

    public void setLb3(JLabel lb3) {
        this.lb3 = lb3;
    }

    public JLabel getLb4() {
        return lb4;
    }

    public void setLb4(JLabel lb4) {
        this.lb4 = lb4;
    }

    public JLabel getLb5() {
        return lb5;
    }

    public void setLb5(JLabel lb5) {
        this.lb5 = lb5;
    }

    public JLabel getLb6() {
        return lb6;
    }

    public void setLb6(JLabel lb6) {
        this.lb6 = lb6;
    }

    public JLabel getLb7() {
        return lb7;
    }

    public void setLb7(JLabel lb7) {
        this.lb7 = lb7;
    }

    public JLabel getLb8() {
        return lb8;
    }

    public void setLb8(JLabel lb8) {
        this.lb8 = lb8;
    }

    public JLabel getLbInfo() {
        return lbInfo;
    }

    public void setLbInfo(JLabel lbInfo) {
        this.lbInfo = lbInfo;
    }

    public JLabel getLbTop() {
        return lbTop;
    }

    public void setLbTop(JLabel lbTop) {
        this.lbTop = lbTop;
    }

    public JLabel getLbGuide() {
        return lbGuide;
    }

    public void setLbGuide(JLabel lbGuide) {
        this.lbGuide = lbGuide;
    }

    public JTextField getTxtAccNo() {
        return txtAccNo;
    }

    public void setTxtAccNo(JTextField txtAccNo) {
        this.txtAccNo = txtAccNo;
    }

    public JPasswordField getPfPIN() {
        return pfPIN;
    }

    public JFormattedTextField getPfCash() {
        return pfCash;
    }

    public JProgressBar getPbTransaction() {
        return pbTransaction;
    }

    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        bt1 = new javax.swing.JButton();
        bt2 = new javax.swing.JButton();
        bt3 = new javax.swing.JButton();
        bt4 = new javax.swing.JButton();
        bt5 = new javax.swing.JButton();
        bt6 = new javax.swing.JButton();
        bt7 = new javax.swing.JButton();
        bt8 = new javax.swing.JButton();
        lb1 = new javax.swing.JLabel();
        lb2 = new javax.swing.JLabel();
        lb3 = new javax.swing.JLabel();
        lb4 = new javax.swing.JLabel();
        lb5 = new javax.swing.JLabel();
        lb6 = new javax.swing.JLabel();
        lb7 = new javax.swing.JLabel();
        lb8 = new javax.swing.JLabel();
        lbTop = new javax.swing.JLabel();
        lbInfo = new javax.swing.JLabel();
        lbGuide = new javax.swing.JLabel();
        txtAccNo = new javax.swing.JTextField();
        lbMid = new javax.swing.JLabel();
        pfPIN = new javax.swing.JPasswordField();
        pfCash = new javax.swing.JFormattedTextField();
        pbTransaction = new javax.swing.JProgressBar();
        lbInquiry = new javax.swing.JLabel();
        lbType = new javax.swing.JLabel();
        lbAmount = new javax.swing.JLabel();
        lbTime = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        getContentPane().add(bt1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 261, -1, 33));
        getContentPane().add(bt2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 346, -1, 33));
        getContentPane().add(bt3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 426, -1, 32));
        getContentPane().add(bt4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 509, -1, 33));
        getContentPane().add(bt5, new org.netbeans.lib.awtextra.AbsoluteConstraints(697, 259, -1, 33));
        getContentPane().add(bt6, new org.netbeans.lib.awtextra.AbsoluteConstraints(697, 347, -1, 32));
        getContentPane().add(bt7, new org.netbeans.lib.awtextra.AbsoluteConstraints(697, 426, -1, 32));
        getContentPane().add(bt8, new org.netbeans.lib.awtextra.AbsoluteConstraints(697, 509, -1, 33));

        lb1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        lb1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        lb1.setText("RÚT TIỀN");
        getContentPane().add(lb1, new org.netbeans.lib.awtextra.AbsoluteConstraints(53, 265, 260, -1));

        lb2.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        lb2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        lb2.setText("VẤN TIN TÀI KHOẢN");
        getContentPane().add(lb2, new org.netbeans.lib.awtextra.AbsoluteConstraints(53, 346, 270, -1));

        lb3.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        lb3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        lb3.setText("CHUYỂN KHOẢN");
        getContentPane().add(lb3, new org.netbeans.lib.awtextra.AbsoluteConstraints(53, 429, 260, -1));

        lb4.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        lb4.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        lb4.setText("THOÁT");
        getContentPane().add(lb4, new org.netbeans.lib.awtextra.AbsoluteConstraints(53, 513, 240, -1));

        lb5.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        lb5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lb5.setText("THÔNG TIN");
        getContentPane().add(lb5, new org.netbeans.lib.awtextra.AbsoluteConstraints(417, 265, 270, -1));

        lb6.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        lb6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lb6.setText("LB6");
        getContentPane().add(lb6, new org.netbeans.lib.awtextra.AbsoluteConstraints(417, 350, 270, -1));

        lb7.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        lb7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lb7.setText("LB7");
        getContentPane().add(lb7, new org.netbeans.lib.awtextra.AbsoluteConstraints(417, 429, 270, -1));

        lb8.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        lb8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lb8.setText("LB8");
        getContentPane().add(lb8, new org.netbeans.lib.awtextra.AbsoluteConstraints(417, 513, 270, -1));

        lbTop.setFont(new java.awt.Font("Tahoma", 1, 28)); // NOI18N
        lbTop.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lbTop.setText("message");
        getContentPane().add(lbTop, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 70, 600, 170));

        lbInfo.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        lbInfo.setForeground(new java.awt.Color(0, 0, 102));
        lbInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lbInfo.setText("abc");
        getContentPane().add(lbInfo, new org.netbeans.lib.awtextra.AbsoluteConstraints(273, 577, 190, 20));

        lbGuide.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        lbGuide.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lbGuide.setText("Enter");
        getContentPane().add(lbGuide, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 490, 300, 30));

        txtAccNo.setBackground(new java.awt.Color(153, 255, 255));
        txtAccNo.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
        txtAccNo.setForeground(new java.awt.Color(0, 0, 153));
        txtAccNo.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        getContentPane().add(txtAccNo, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 250, 500, 60));

        lbMid.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        lbMid.setForeground(new java.awt.Color(255, 51, 51));
        lbMid.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lbMid.setText("error");
        getContentPane().add(lbMid, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 320, 500, 170));

        pfPIN.setBackground(new java.awt.Color(153, 255, 255));
        pfPIN.setFont(new java.awt.Font("Tahoma", 1, 45)); // NOI18N
        pfPIN.setForeground(new java.awt.Color(0, 0, 204));
        pfPIN.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        pfPIN.setText("****");
        getContentPane().add(pfPIN, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 240, 200, 70));

        pfCash.setBackground(new java.awt.Color(153, 255, 255));
        pfCash.setForeground(new java.awt.Color(0, 0, 204));
        pfCash.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("VND#,##0"))));
        pfCash.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        pfCash.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
        pfCash.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pfCashActionPerformed(evt);
            }
        });
        getContentPane().add(pfCash, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 270, 270, 50));

        pbTransaction.setBackground(new java.awt.Color(0, 255, 0));
        pbTransaction.setForeground(new java.awt.Color(51, 255, 51));
        getContentPane().add(pbTransaction, new org.netbeans.lib.awtextra.AbsoluteConstraints(206, 270, 340, 30));

        lbInquiry.setBackground(new java.awt.Color(0, 255, 255));
        lbInquiry.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        lbInquiry.setForeground(new java.awt.Color(0, 0, 255));
        lbInquiry.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        getContentPane().add(lbInquiry, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 170, 510, 360));

        lbType.setBackground(new java.awt.Color(153, 255, 255));
        lbType.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
        lbType.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        getContentPane().add(lbType, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 170, 210, 340));

        lbAmount.setBackground(new java.awt.Color(153, 255, 255));
        lbAmount.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
        lbAmount.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        getContentPane().add(lbAmount, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 170, 180, 340));

        lbTime.setBackground(new java.awt.Color(153, 255, 255));
        lbTime.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
        lbTime.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        getContentPane().add(lbTime, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 170, 270, 340));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void pfCashActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pfCashActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_pfCashActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(ATMUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(ATMUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(ATMUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(ATMUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the form */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new ATMUser().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bt1;
    private javax.swing.JButton bt2;
    private javax.swing.JButton bt3;
    private javax.swing.JButton bt4;
    private javax.swing.JButton bt5;
    private javax.swing.JButton bt6;
    private javax.swing.JButton bt7;
    private javax.swing.JButton bt8;
    private javax.swing.JLabel lb1;
    private javax.swing.JLabel lb2;
    private javax.swing.JLabel lb3;
    private javax.swing.JLabel lb4;
    private javax.swing.JLabel lb5;
    private javax.swing.JLabel lb6;
    private javax.swing.JLabel lb7;
    private javax.swing.JLabel lb8;
    private javax.swing.JLabel lbAmount;
    private javax.swing.JLabel lbGuide;
    private javax.swing.JLabel lbInfo;
    private javax.swing.JLabel lbInquiry;
    private javax.swing.JLabel lbMid;
    private javax.swing.JLabel lbTime;
    private javax.swing.JLabel lbTop;
    private javax.swing.JLabel lbType;
    private javax.swing.JProgressBar pbTransaction;
    private javax.swing.JFormattedTextField pfCash;
    private javax.swing.JPasswordField pfPIN;
    private javax.swing.JTextField txtAccNo;
    // End of variables declaration//GEN-END:variables
}

class ContentPanel extends JPanel {

    Image bgimage = null;

    ContentPanel() {
        MediaTracker mt = new MediaTracker(this);
        bgimage = Toolkit.getDefaultToolkit().getImage("image/background.jpg");
        mt.addImage(bgimage, 0);
        try {
            mt.waitForAll();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        int imwidth = bgimage.getWidth(null);
        int imheight = bgimage.getHeight(null);
        g.drawImage(bgimage, 1, 1, null);
    }
}
